<?php

namespace YmPhp\Admin\Http\Controllers\Business;

use YmPhp\Admin\Models\Business\BusinessActivityReceive;
use YmPhp\Admin\Form;
use YmPhp\Admin\Grid;
use YmPhp\Admin\Show;
use YmPhp\Admin\Http\Controllers\AdminController;

class BusinessActivityReceiveController extends AdminController
{
    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        return Grid::make(new BusinessActivityReceive(), function (Grid $grid) {
            $grid->column('id')->sortable();
            $grid->column('shid');
            $grid->column('uid');
            $grid->column('rate');
            $grid->column('code');
            $grid->column('status');
            $grid->column('hxstatus');
            $grid->column('usedate');
            $grid->column('usets');
            $grid->column('start_at');
            $grid->column('end_at');
            $grid->column('created_at');
            $grid->column('updated_at')->sortable();

            $grid->filter(function (Grid\Filter $filter) {
                $filter->equal('id');

            });
        });
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     *
     * @return Show
     */
    protected function detail($id)
    {
        return Show::make($id, new BusinessActivityReceive(), function (Show $show) {
            $show->field('id');
            $show->field('shid');
            $show->field('uid');
            $show->field('rate');
            $show->field('note');
            $show->field('startts');
            $show->field('code');
            $show->field('status');
            $show->field('hxstatus');
            $show->field('usedate');
            $show->field('hxmoney');
            $show->field('hxratemoney');
            $show->field('hxcrts');
            $show->field('hxuid');
            $show->field('hxnote');
            $show->field('usets');
            $show->field('gid');
            $show->field('stid');
            $show->field('start_at');
            $show->field('end_at');
            $show->field('created_at');
            $show->field('updated_at');
        });
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        return Form::make(new BusinessActivityReceive(), function (Form $form) {
            $form->display('id');
            $form->text('shid');
            $form->text('uid');
            $form->text('rate');
            $form->text('note');
            $form->text('startts');
            $form->text('code');
            $form->text('status');
            $form->text('hxstatus');
            $form->text('usedate');
            $form->text('hxmoney');
            $form->text('hxratemoney');
            $form->text('hxcrts');
            $form->text('hxuid');
            $form->text('hxnote');
            $form->text('usets');
            $form->text('gid');
            $form->text('stid');
            $form->text('start_at');
            $form->text('end_at');

            $form->display('created_at');
            $form->display('updated_at');
        });
    }
}
